/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author usuario
 */
@Entity
@Table(name = "pagocliente")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Pagocliente.findAll", query = "SELECT p FROM Pagocliente p"),
    @NamedQuery(name = "Pagocliente.findByNropago", query = "SELECT p FROM Pagocliente p WHERE p.pagoclientePK.nropago = :nropago"),
    @NamedQuery(name = "Pagocliente.findByIdventa", query = "SELECT p FROM Pagocliente p WHERE p.pagoclientePK.idventa = :idventa"),
    @NamedQuery(name = "Pagocliente.findByFechapago", query = "SELECT p FROM Pagocliente p WHERE p.fechapago = :fechapago"),
    @NamedQuery(name = "Pagocliente.findByMonto", query = "SELECT p FROM Pagocliente p WHERE p.monto = :monto")})
public class Pagocliente implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected PagoclientePK pagoclientePK;
    @Basic(optional = false)
    @Column(name = "fechapago")
    @Temporal(TemporalType.DATE)
    private Date fechapago;
    @Basic(optional = false)
    @Column(name = "monto")
    private double monto;
    @JoinColumn(name = "idventa", referencedColumnName = "idventa", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Venta venta;
    @JoinColumn(name = "idempleado", referencedColumnName = "idempleado")
    @ManyToOne(optional = false)
    private Empleado idempleado;

    public Pagocliente() {
    }

    public Pagocliente(PagoclientePK pagoclientePK) {
        this.pagoclientePK = pagoclientePK;
    }

    public Pagocliente(PagoclientePK pagoclientePK, Date fechapago, double monto) {
        this.pagoclientePK = pagoclientePK;
        this.fechapago = fechapago;
        this.monto = monto;
    }

    public Pagocliente(int nropago, String idventa) {
        this.pagoclientePK = new PagoclientePK(nropago, idventa);
    }

    public PagoclientePK getPagoclientePK() {
        return pagoclientePK;
    }

    public void setPagoclientePK(PagoclientePK pagoclientePK) {
        this.pagoclientePK = pagoclientePK;
    }

    public Date getFechapago() {
        return fechapago;
    }

    public void setFechapago(Date fechapago) {
        this.fechapago = fechapago;
    }

    public double getMonto() {
        return monto;
    }

    public void setMonto(double monto) {
        this.monto = monto;
    }

    public Venta getVenta() {
        return venta;
    }

    public void setVenta(Venta venta) {
        this.venta = venta;
    }

    public Empleado getIdempleado() {
        return idempleado;
    }

    public void setIdempleado(Empleado idempleado) {
        this.idempleado = idempleado;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (pagoclientePK != null ? pagoclientePK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Pagocliente)) {
            return false;
        }
        Pagocliente other = (Pagocliente) object;
        if ((this.pagoclientePK == null && other.pagoclientePK != null) || (this.pagoclientePK != null && !this.pagoclientePK.equals(other.pagoclientePK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "modelo.Pagocliente[ pagoclientePK=" + pagoclientePK + " ]";
    }
    
}
